package com.weslide.weslideapp.parser;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.weslide.weslideapp.pojo.ao.GiftAO;

public class GetGiftDetailParser {
	private GiftAO giftAO = new GiftAO();

	public void parser(String jsonString) throws JSONException {
		JSONArray jsonArray = new JSONArray(jsonString);
		JSONObject statusJsonObject = jsonArray.getJSONObject(0);
		giftAO.setStatus(statusJsonObject.getString("status"));
		if (giftAO.getStatus().equals("1")) {
			JSONObject dataJsonObject = jsonArray.getJSONObject(1);
			giftAO.setGoodId(dataJsonObject.getString("good_id"));
			giftAO.setName(dataJsonObject.getString("name"));
			giftAO.setNeedScore(dataJsonObject.getString("need_score"));
			giftAO.setMoney(dataJsonObject.getString("money"));
			giftAO.setShopTypeId(dataJsonObject.getString("shoptype_id"));
			giftAO.setShopTypeName(dataJsonObject.getString("shoptype_name"));
			giftAO.setTcount(dataJsonObject.getString("tcount"));
			giftAO.setOcount(dataJsonObject.getString("ocount"));
			giftAO.setImgUrl(dataJsonObject.getString("imgurls"));
			giftAO.setPhone(dataJsonObject.getString("phone"));
			giftAO.setDescription(dataJsonObject.getString("description"));
			giftAO.setRemark(dataJsonObject.getString("remark"));
		}
	}

	public GiftAO getData() {
		return giftAO;
	}
}
